home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / man / cat.3 / TildeSubst.3 < prev    next >
Encoding:
Text File  |  1995-07-26  |  5.5 KB  |  133 lines

  1.  
  2.  
  3.  
  4.      TTTTccccllll____TTTTiiiillllddddeeeeSSSSuuuubbbbsssstttt((((3333))))           TTTTccccllll ((((7777....0000))))           TTTTccccllll____TTTTiiiillllddddeeeeSSSSuuuubbbbsssstttt((((3333))))
  5.  
  6.  
  7.  
  8.      _________________________________________________________________
  9.  
  10.      NNNNAAAAMMMMEEEE
  11.           Tcl_TildeSubst - replace tilde with home directory in a file
  12.           name
  13.  
  14.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  15.           ####iiiinnnncccclllluuuuddddeeee <<<<ttttccccllll....hhhh>>>>
  16.  
  17.           char *
  18.           TTTTccccllll____TTTTiiiillllddddeeeeSSSSuuuubbbbsssstttt(_i_n_t_e_r_p, _n_a_m_e, _b_u_f_f_e_r_P_t_r)                       |
  19.  
  20.      AAAARRRRGGGGUUUUMMMMEEEENNNNTTTTSSSS
  21.           Tcl_Interp    *_i_n_t_e_r_p      (in)      Interpreter in which to
  22.                                                report   an  error,  if
  23.                                                any.
  24.  
  25.           char          *_n_a_m_e        (in)      File  name,  which  may
  26.                                                start with a ``~''.
  27.  
  28.           Tcl_DString   *_b_u_f_f_e_r_P_t_r             If needed, this dynamic  |
  29.                                                string is used to store  |
  30.                                                the new file name.   At  |
  31.                                                the time of the call it  |
  32.                                                should be uninitialized  |
  33.                                                or  empty.   The caller  |
  34.                                                must  eventually   call  |
  35.                                                TTTTccccllll____DDDDSSSSttttrrrriiiinnnnggggFFFFrrrreeeeeeee to free  |
  36.                                                up   anything    stored  |
  37.                                                here.
  38.      _________________________________________________________________
  39.  
  40.  
  41.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  42.           This utility  procedure  does  tilde  substition.   If  _n_a_m_e
  43.           doesn't  start  with  a  ``~'' character, then the procedure
  44.           returns _n_a_m_e.   If  _n_a_m_e  does  start  with  a  tilde,  then
  45.           TTTTccccllll____TTTTiiiillllddddeeeeSSSSuuuubbbbsssstttt returns a new string identical to _n_a_m_e except
  46.           that the first element of _n_a_m_e is replaced with the location
  47.           of  the home directory for the given user.  The substitution
  48.           is carried out in the same way that it would be done by _c_s_h.
  49.           If  the  tilde  is followed immediately by a slash, then the
  50.           $$$$HHHHOOOOMMMMEEEE environment variable is  substituted.   Otherwise  the
  51.           characters between the tilde and the next slash are taken as
  52.           a user name, which is looked up in the password  file;   the
  53.           user's  home  directory  is retrieved from the password file
  54.           and substituted.
  55.  
  56.           If TTTTccccllll____TTTTiiiillllddddeeeeSSSSuuuubbbbsssstttt has to do tilde substitution then it  uses  |
  57.           the  dynamic  string at *_b_u_f_f_e_r_P_t_r to hold the new string it  |
  58.           generates.  After TTTTccccllll____TTTTiiiillllddddeeeeSSSSuuuubbbbsssstttt returns,  the  caller  must  |
  59.           eventually invoke TTTTccccllll____DDDDSSSSttttrrrriiiinnnnggggFFFFrrrreeeeeeee to free up any information  |
  60.  
  61.  
  62.  
  63.      Page 1                                          (printed 7/10/95)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      TTTTccccllll____TTTTiiiillllddddeeeeSSSSuuuubbbbsssstttt((((3333))))           TTTTccccllll ((((7777....0000))))           TTTTccccllll____TTTTiiiillllddddeeeeSSSSuuuubbbbsssstttt((((3333))))
  71.  
  72.  
  73.  
  74.           placed in *_b_u_f_f_e_r_P_t_r.  The caller need not know  whether  or  |
  75.           not TTTTccccllll____TTTTiiiillllddddeeeeSSSSuuuubbbbsssstttt actually used the string;  TTTTccccllll____TTTTiiiillllddddeeeeSSSSuuuubbbbsssstttt  |
  76.           initializes *_b_u_f_f_e_r_P_t_r even if it doesn't  use  it,  so  the  |
  77.           call to TTTTccccllll____DDDDSSSSttttrrrriiiinnnnggggFFFFrrrreeeeeeee will be safe in either case.
  78.  
  79.           If an error occurs (e.g. because there was no  user  by  the
  80.           given  name) then NULL is returned and an error message will
  81.           be left at  _i_n_t_e_r_p->_r_e_s_u_l_t.   It  is  assumed  that  _i_n_t_e_r_p-
  82.           >_r_e_s_u_l_t  has  been  initialized  in  the  standard  way when
  83.           TTTTccccllll____TTTTiiiillllddddeeeeSSSSuuuubbbbsssstttt is invoked.
  84.  
  85.  
  86.      KKKKEEEEYYYYWWWWOOOORRRRDDDDSSSS
  87.           file name, home directory, tilde, user
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.      Page 2                                          (printed 7/10/95)
  130.  
  131.  
  132.  
  133.